# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer:
pkgname=lua-middleclass
pkgver=4.0.0
pkgrel=0
_luaversions="5.1 5.2 5.3"
pkgdesc="Object-orientation for Lua"
url="https://github.com/kikito/middleclass"
arch="noarch"
license="MIT"
depends=""
depends_dev=""
makedepends="$depends_dev"
install=""
subpackages=""
source="middleclass-$pkgver.tar.gz::https://github.com/kikito/middleclass/archive/v$pkgver.tar.gz"

for _v in $_luaversions; do
	subpackages="$subpackages lua$_v-${pkgname#*lua-}:split_${_v/./_}"
	eval "split_${_v/./_}() { _split $_v; }"
done

builddir="$srcdir"/middleclass-$pkgver

build() {
	return 0
}

package() {
	mkdir -p "$pkgdir"
}

_split() {
        cd "$builddir"
        local _ver="$1"
        install_if="lua$_ver $pkgname=$pkgver-r$pkgrel"
        pkgdesc="Object-orientation for Lua $_ver"
        install -Dm644 middleclass.lua \
                "$subpkgdir/usr/share/lua/$_ver/middleclass.lua" || return 1
}

sha512sums="c648bd3fd9bc2e3edf802c04734b1e940311cc7a1556c51336047a52ae2b0fa7d107f3c8509ffb51cce49e865e9a6e22f4cd53f6e50255d26819060159d228a2  middleclass-4.0.0.tar.gz"
